package com.zhuiYun.project.api.order.mapper;

import com.zhuiYun.project.api.order.model.diyorderModel;
import com.zhuiYun.project.api.order.model.orderModel;
import com.zhuiYun.project.common.mapper.BaseMapper;
import com.zhuiYun.project.util.pageUtil.PageRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface diyorderMapper extends BaseMapper<diyorderModel> {



    /**
     * @Author 小江
     * @Description //TODO  订单全查（模糊查）
     * @Date 10:40 2023/4/4
     **/

    @Select("SELECT a.*,b.nick_name AS userB,c.diy_name a.diyPrice AS diynameC " +
            "FROM handwork_diy_order a LEFT JOIN orders d ON d.id = a.orders_id LEFT JOIN user b ON d.user_id = b.id LEFT JOIN handwork_diy c ON a.diy_id = c.id where d.id=#{id}")

    @Results({
            @Result(property="diyOrderNumber",column="diy_order_number"),
            @Result(property="userId",column="user_id"),
            @Result(property="ordersId",column="orders_id"),
            @Result(property="diyId",column="diy_id"),
            @Result(property="createTime",column="create_time"),
            @Result(property="arrivalTime",column="arrival_time"),
            @Result(property="arrivalNum",column="arrival_num"),
            @Result(property="handworkDiyQuantity",column="handwork_diy_quantity"),
    })
    List<diyorderModel> diyorderList(diyorderModel diyorderMode);

}
